# TODO: Add comment
# 
# Author: Forever
###############################################################################

#all_daily
data=read.csv("C:/data1/all_daily.csv")
data1=subset(data,data$station!=3)
total_row=nrow(data1)
data1$area_id=c(1:total_row)

data1$area_id[data1$station==1]<-3
data1$area_id[data1$station==2]<-4
data1$area_id[data1$station==3]<-5
data1$area_id[data1$station==4]<-2
data1$area_id[data1$station==5]<-5

data2=read.csv("C:/data1/AvgTempPress.csv")
final=merge(data1,data2,c("area_id","month"))
write.csv(final,"C:/data1/all_daily_merge.csv")

#myd daily

data=read.csv("C:/data1/myd_daily.csv")
data1=subset(data,data$station!=3)
total_row=nrow(data1)
data1$area_id=c(1:total_row)

data1$area_id[data1$station==1]<-3
data1$area_id[data1$station==2]<-4
data1$area_id[data1$station==3]<-5
data1$area_id[data1$station==4]<-2
data1$area_id[data1$station==5]<-5

data2=read.csv("C:/data/AvgTempPress.csv")
final=merge(data1,data2,c("area_id","month"))
write.csv(final,"C:/data1/myd_daily_merge.csv")


#mod daily

data=read.csv("C:/data1/mod_daily.csv")
data1=subset(data,data$station!=3)
total_row=nrow(data1)
data1$area_id=c(1:total_row)

data1$area_id[data1$station==1]<-3
data1$area_id[data1$station==2]<-4
data1$area_id[data1$station==3]<-5
data1$area_id[data1$station==4]<-2
data1$area_id[data1$station==5]<-5

data2=read.csv("C:/data/AvgTempPress.csv")
final=merge(data1,data2,c("area_id","month"))
write.csv(final,"C:/data1/mod_daily_merge.csv")

#myd

data=read.csv("C:/data1/myd.csv")
data1=subset(data,data$station!=3)
total_row=nrow(data1)
data1$area_id=c(1:total_row)

data1$area_id[data1$station==1]<-3
data1$area_id[data1$station==2]<-4
data1$area_id[data1$station==3]<-5
data1$area_id[data1$station==4]<-2
data1$area_id[data1$station==5]<-5

data2=read.csv("C:/data/AvgTempPress.csv")
final=merge(data1,data2,c("area_id","month"))
write.csv(final,"C:/data1/myd_merge.csv")


#mod

data=read.csv("C:/data1/mod.csv")
data1=subset(data,data$station!=3)
total_row=nrow(data1)
data1$area_id=c(1:total_row)

data1$area_id[data1$station==1]<-3
data1$area_id[data1$station==2]<-4
data1$area_id[data1$station==3]<-5
data1$area_id[data1$station==4]<-2
data1$area_id[data1$station==5]<-5

data2=read.csv("C:/data/AvgTempPress.csv")
final=merge(data1,data2,c("area_id","month"))
write.csv(final,"C:/data1/mod_merge.csv")



